package cn.mvc.web.controller;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 原生的 Servlet 方式
 *
 * @author yexi
 */
@WebServlet("/customServlet")
public class CustomServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 请求转发至
        RequestDispatcher rd = req.getRequestDispatcher("/WEB-INF/views/common.jsp");
        // 做出转发动作
        rd.forward(req, resp);
    }
}